%this function finds the different parts of the name of a .vec file

%created by Ricardo Mejia-Alvarez.
%University of Illinois at Urbana-Champaign
%Urbana, IL. 02/08/10


function [FileName,FirstName,MiddleName,LastName] = filename(path)
if ispc == 1
    slash(1 : length(path)) = '\';
else
    slash(1 : length(path)) = '/';
end
namelimit = find(path - slash == 0, 1, 'last');
FileName = path(namelimit + 1 : end );

period(1 : length(FileName) ) = '.';
LastNameLimit = find(FileName - period == 0, 1, 'first');
LastName = FileName(LastNameLimit : end );

MiddleNameLimit = LastNameLimit - 6;
MiddleName = FileName(MiddleNameLimit : MiddleNameLimit + 5 );

FirstName = FileName(1 : MiddleNameLimit - 1 );

end
